<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no" />
    <link rel="stylesheet" type="text/css" href="../css/neibuyuangongbaoming.css" />
    <title>填写资料</title>
</head>
<body>
    <div id="detail">
        <!-- <div class="act"><b>活动主题</b>：活动里程5折抢购</div>
        <div class="act"><b>活动时间</b>：2017年8月1日-2017年9月25日</div> -->
    </div>
    <!-- 活动标题时间模板 begin -->
    <script type="text/html" id="detail-template">
        <div class="act"><b>活动名称</b>：{{title}}</div>
        <div class="act"><b>活动时间</b>：{{time_start.split(' ')[0]}} 至 {{time_end.split(' ')[0]}}</div>
		
		<!-- 活动标题时间模板 end -->
		<div class="content">
			<div class="basic"><span class="color">*</span><b>填写资料</b></div>

			<div class="frame">
				<span class="name">姓名：</span>
				<div class="input">
					<input type="text" id="name" placeholder="填写真实姓名">
				</div>
			</div>
			<div class="frame">
				<span class="name">联系电话：</span>
				<div class="input">
					<input type="tel" placeholder="+86" id="tel">
				</div>
			</div>
			<div class="frame number">
				<span class="name">工牌号：</span>
				<div class="input">
					<input type="text" id="unit_number" placeholder="请填写工牌号">
				</div>
			</div>
			<div class="submit" onclick="fnSubmit()">前去抽奖</div> 
		</div>
    </script>
</body>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="../framework/template-web.js"></script>
<script type="text/javascript" src="../framework/zepto.min.js"></script>
<script type="text/javascript" src="../script/base.js"></script>
<script type="text/javascript">
    var param =  fnGetUrlParam();
    fnDetails();
    function fnDetails(){
        fnAjax({
			url: "Draw/detail",
			data: {
				id:fnGetUrlParam().id
			},
		}, function(ret){
			if( !ret.status ){
				if(ret.data){
					fnValue('#detail',template('detail-template', ret.data));
				}
			}else{
				
			}
		});
    }


    //选择性别
    function fnSex( _el ){
        $('.gender').removeClass('active');
        $( _el ).addClass('active');
    }

    //提交申请
    function fnSubmit(){
                    // fnOpen("turntable.html",fnGetUrlParam());
                    // return;
        var _param = {};
        _param.active_id = param.id;
        if(fnValue("#name")){
            _param.name = fnValue("#name");
        }else{
            fnToast('请填写真实姓名');
            return
        }
        if(fnValue("#tel")){
            if( fnVerify( 'Phone' ).test( fnValue( '#tel' ) )){
                _param.phone = fnValue("#tel");
            }else{
                fnToast('手机号码格式错误');
                return
            }
        }else{
            fnToast('请填写手机号码');
            return
        }
        if(fnValue("#unit_number")){
            _param.unit_number = fnValue("#unit_number");
        }else{
            fnToast('请填写工号牌');
            return
        }
        fnAjax({
            url: "Draw/fnSubmitInfo",
            data: _param,
        }, function(ret){
            if( !ret.status ){
                fnOpen("turntable.html",fnGetUrlParam());
            }else{
                fnToast(ret.msg);
            }
        });
    }
</script>
</html>
